feat: expand pull request review context and panel tabs - #5546
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Effect service conventions
Reviewed the Effect service code in this PR's changed scope, focused on the follow-up commits (92f8ba5e1..9393ecc32) that add the pullRequests.diffFileContents path through the provider CLIs, provider port, service, RPC and client runtime.
Service shape is fine: Context.Service tags with inline interfaces, namespace imports from effect/* subpaths, make + layer in canonical order, Foo["Service"] member types, dependencies acquired with yield* Foo.Foo, no ManagedRuntime/runPromise outside application boundaries, and the optional getDiffFileContents port member is guarded by the provider capability rather than faked.
Four findings, all the same convention: the new non-decode failures in getPullRequestDiffFileContents / getMergeRequestDiffFileContents are funnelled into the decode-oriented *ReadError with a manufactured new Error(...) as cause, which both invents a cause where no failure occurred and leaves the real context (file path, why the read is refused) only inside a string. Both files already model this class of outcome as its own tagged error (GitHubDiffCursorError, GitHubDiffCommitError, GitLabDiffCommitError, GitLabViewerUnavailableError), so the fix follows the sibling pattern.
Posted via Macroscope — Effect Service Conventions
|
Closing because targeting main included the unmerged ancestry from #4849 instead of showing only this follow-up's three commits. |
ApprovabilityVerdict: Needs human review This PR adds a substantial new feature enabling diff file expansion in pull request reviews and multi-tab PR support. It introduces a new RPC endpoint, implements new provider methods across GitHub/GitLab/Azure DevOps/Bitbucket, refactors pagination logic, and changes the UI panel architecture. The scope and new capabilities warrant human review. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aaf8a2b. Configure here.

Dependency
This is an upstream stacked follow-up to #4849. It is based directly on #4849's current head (
08225ba0) and is not intended to replace that PR.The temporary upstream base branch
stack/pr-4849-basepoints exactly at that commit so this PR's commit list and Files changed view contain only this follow-up:92f8ba5e1 refactor(web): share diff rendering foundations8b10e5bf0 feat(pull-requests): expand omitted diff context9393ecc32 feat(web): keep pull requests open as panel tabsThis PR should merge only after #4849. Once #4849 lands, retarget this PR to
mainand delete the temporary base branch.Why
The in-app review flow in #4849 had three connected gaps:
What changed
Shared diff foundations
StyledDiffCodeView, the single web adapter around Pierre'sCodeView. It keeps app styling and virtualized row measurements together so visual changes cannot silently desynchronize scrolling geometry.LocalCommentAnnotationand pull-request-only composer withDiffCommentAnnotation, shared by file previews, thread diffs, and pull request diffs.CodeViewusage through the shared adapter.Expand omitted pull request context
pullRequests.diffFileContentsRPC through contracts, authorization, WebSocket dispatch, client-runtime state, the pull request service, and provider adapters.Keep reviews in compact panel tabs
Impact and scope
Validation
6 test files passed, 47 tests passed.
Built with GPT-5.6 Sol via the Codex harness in T3 Code.
Note
Medium Risk
Touches multi-provider PR listing cursors, new host API paths for file contents, and persisted right-panel state migration; mistakes could skip or duplicate list rows or mis-handle auth/binary files.
Overview
Extends in-app pull request review so readers can expand omitted diff context without a local checkout, keep several PRs open as right-panel tabs, and see consistent diff rendering and inline comments across thread diffs, file previews, and PR reviews.
Diff file expansion: New
pullRequests.diffFileContentsRPC (auth, WS, service, client atoms) fetches full old/new file text at the revisions used for the patch on GitHub and GitLab (1 MB cap, binary/oversized errors, root commits for new files). Providers wire throughgetDiffFileContents; the PR Code tab uses shared loaders like the threadDiffPanel.Shared web diff layer:
StyledDiffCodeViewcentralizes PierreCodeViewstyling and virtualized geometry;DiffCommentAnnotationreplaces the file-only composer.DiffPaneldrops inline CSS in favor of the shared adapter andcreateGitDiffFileContentsLoader.Panel tabs: PR surfaces are keyed by project/repository/number; tab icons reflect open/draft/closed/merged state from the detail panel. Terminal is disabled in the empty state when there is no project thread.
Provider pagination and robustness: Azure DevOps and GitLab list APIs return
cursorAdvance(including malformed raw rows) and keep fetching until pages fill; GitLab continuation uses offset instead ofupdated_before. GitHub’s search-free fallback applies local state/involvement filters, grows scan up to 1k rows, and tracks team review requests. Bitbucket paginates diffstat, commits, and checks; 401-only maps to unauthenticated. Process output gainsstdoutInvalidUtf8/stderrInvalidUtf8viadecodeUtf8for safer blob reads.Permissions fix: When review-thread GraphQL fails, GitHub no longer assumes the viewer authored the PR (
didAuthor: false).Reviewed by Cursor Bugbot for commit d513604. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add tabbed right panel for pull request reviews with full diff file contents expansion
pullRequests.diffFileContentsRPC fetches full old/new file contents for diff entries, backed by provider-specific implementations for GitHub, GitLab, and Bitbucket; binary and oversized files (>1 MB) are rejected with structured errors.listMergeRequestsandlistPullRequestspagination switches to stable offset-based cursoring using acursorAdvancefield that counts raw rows consumed including malformed ones.nextpagination links to retrieve complete multi-page results.DiffCommentAnnotationreplacesLocalCommentAnnotation/ReviewCommentComposeracross diff surfaces, gaining configurable labels, an optional secondary action (AI Ask), and a pending guard; a sharedStyledDiffCodeViewwrapper centralizes diff viewer styling.PullRequestReviewBarnow snapshots comments at submit time and only removes those exact IDs afterward, preventing accidental loss of new drafts added during submission.RIGHT_PANEL_STORAGE_VERSIONbumps to 9, triggering migration of persisted right-panel state; legacy singleton pull-request surfaces are rebuilt with reference-keyed IDs.Macroscope summarized d513604.